package com.example.javatwo.controller.cg.lmx;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.javatwo.pojo.cg.djg.Purchase;
import com.example.javatwo.pojo.cg.lmx.CaiGouRuKuX;
import com.example.javatwo.pojo.cg.lmx.CaiGouRuKuZ;
import com.example.javatwo.service.cg.lmx.CaiGouRuKuXService;

@Controller

public class Contr {
	
	@Autowired
	private CaiGouRuKuXService caiGouRuKuXService;
	
	@RequestMapping("/cc")
	
	public String bb() throws Exception{
		return "cg/lmx/cgrk";
	}
	

	@RequestMapping("/bb1")
	@ResponseBody
	public Object bb1() throws Exception{
		
		return this.caiGouRuKuXService.findAll();
	}
	@RequestMapping("/ss")
	@ResponseBody
	public Object ss()throws Exception{
		return caiGouRuKuXService.select();
	}
	@RequestMapping("/cgrkinsert")
	@ResponseBody
	public void insert (@RequestBody CaiGouRuKuZ zhu)throws Exception{
		
		caiGouRuKuXService.insert(zhu);
	} 
	@RequestMapping("/cgrkpage")
	@ResponseBody
	public CaiGouRuKuZ page()throws Exception{
		return null;
	}
	@RequestMapping("/cgrkupdate")
	@ResponseBody
	public void del(@RequestBody CaiGouRuKuZ zhu,String num,String billno,String lineno)throws Exception{
		caiGouRuKuXService.del(zhu,num,billno,lineno);
	}
	@RequestMapping("/maxid")
	@ResponseBody
	public String max(@RequestBody String date)throws Exception{
		System.out.println(date);
		String str=caiGouRuKuXService.queryMaxId(date);
		return str;
	}
	@RequestMapping("/shenhe")
	@ResponseBody
	public void  shenhe(@RequestBody Map<String,Object>map)throws Exception{
		System.out.println("审核传值");
		System.out.println(map);
		System.out.println(map.get("id"));
		//System.out.println(sum+"        "+billNo+"---------"+linno);
		//caiGouRuKuXService.shenhe(map);
	}
	@RequestMapping("/cgrkzhuandan")
	@ResponseBody
	public List<Purchase> selectZhuanDan()throws Exception{
		return caiGouRuKuXService.selectZhuanDan();
	}
	
}
